package com.lau.common.factory;

import com.lau.entity.SysOperLog;
import com.lau.service.ISysOperLogService;
import com.lau.utils.SpringUtils;

import java.util.TimerTask;

/**
 * @author:Lau
 * @create: 2024-01-19 16:10
 * @Description: 异步工厂
 */
public class AsyncFactory {
    /**
     * 操作日志记录
     *
     * @param operLog 操作日志信息
     * @return 任务task
     */
    public static TimerTask recordOperLog(final SysOperLog operLog) {
        return new TimerTask() {
            @Override
            public void run() {
                ISysOperLogService logService = SpringUtils.getBean(ISysOperLogService.class);
                logService.save(operLog);
            }
        };
    }
}
